package com.bwda.dsrs.filecenter.service;

import com.bwda.dsrs.base.centerbase.condition.BaseCondition;
import com.bwda.dsrs.filecenter.domain.exception.BusinessServiceException;

import java.util.List;

/**
 * @author yangjun
 * @date 2019/4/18
 */
public interface BaseService<T, C extends BaseCondition> {
    /**
     * 查询详情
     *
     * @param id
     * @return
     */
    T query(Object id);


    /**
     * 查询验证的详情
     * @param id
     * @return
     * @throws BusinessServiceException
     */
    T queryWithValid(Object id) throws BusinessServiceException;

    /**
     * 查询列表
     *
     * @param condition
     * @return
     */
    List<T> queryList(C condition);

    /**
     * 查询数量
     *
     * @param condition
     * @return
     */
    int queryCount(C condition);

    /**
     * 修改
     *
     * @param po
     * @return
     * @throws BusinessServiceException
     */
    int update(T po);

    /**
     * 修改,失败则抛异常
     *
     * @param po
     * @throws BusinessServiceException
     */
    void updateWithValid(T po) throws BusinessServiceException;

    /**
     * 新增
     *
     * @param po
     */
    void insert(T po);
    /**
     * 新增(返回新增对象)
     * @param po
     * @return
     */
    T  insertPo(T po);
    /**
     * 删除
     *
     * @param id
     * @throws BusinessServiceException
     */
    void delete(Object id) throws BusinessServiceException;
}

